
<#import "/macro.ftl" as m>
<@m.page_header title='后台' />
<div id="page-content-wrapper">

    <div id="page-title">

        <h3>
            页面管理
        </h3>
        <div id="breadcrumb-right">
            <div class="float-right">
            	<a href="/page/add" class="btn medium primary-bg">
                    <span class="button-content">
                    <i class="glyph-icon icon-cog float-left"></i>
                    添加
                    </span>
                </a>
            </div>
        </div>
    </div>
    <div id="page-content">
	    <table class="table" id="exp">
	    </table>
	</div>
</div>
</div>
</div>

<script language="javascript">
$(document).ready(function() {
	//
	<#if msg!=null>
	$.jGrowl("${msg}", { position:"bottom-right",theme: "ui-state-default"});
	</#if>
	function retrieveData( sSource, aoData, fnCallback ) {   
	    aoData.push( { } );   
	    $.ajax( {   
	        "type": "POST",    
	        "contentType": "application/json",   
	        "url": sSource,    
	        "dataType": "json",   
	        "data": JSON.stringify(aoData), //以json格式传递   
	        "success": fnCallback  
	    });   
	}
	
	$(function() {
		$("#exp").dataTable({
			sScrollY: 300,
			bJQueryUI: !0,
			bStateSave: true,
			sPaginationType: "full_numbers",
			aoColumns:[
				{'sTitle':'ID','mDataProp':'id'},
				{'sTitle':'标题','mDataProp':'title'},
				{'sTitle':'作者','mDataProp':'author'},
				{'sTitle':'关键字','mDataProp':'metaKeywords'},
				{'sTitle':'URL','mDataProp':'name'},
				{'sTitle':'发布状态','mDataProp':'published','mRender':function(data, type, full){
					return  data?"发布":"未发布";
				}},
				{'sTitle':'创建时间','mDataProp':'createDate','mRender':function(data, type, full){
					return  new Date(data).Format("yyyy-MM-dd");
				}},
				{'sTitle':'操作','bSortable':false,'mRender':function(data, type, full){
					var html='<div class="dropdown">';
		            html+='<a href="javascript:;" title="" class="btn medium bg-blue" data-toggle="dropdown">';
		            html+='<span class="button-content">';
		            html+='<i class="glyph-icon font-size-11 icon-cog"></i>';
		            html+='<i class="glyph-icon font-size-11 icon-chevron-down"></i>';
		            html+='</span>';
		            html+='</a>';
		            html+='<ul class="dropdown-menu float-right">';
		            html+='<li><a href="/page/'+full.id+'" title=""><i class="glyph-icon icon-edit mrg5R"></i>修改</a></li>';
		            html+='<li><a href="/page/publish/'+full.id+'" title=""><i class="glyph-icon icon-calendar mrg5R"></i>发布</a></li>';
		            html+='<li><a href="javascript:;" id="del_'+full.id+'" class="font-red del" title=""><i class="glyph-icon icon-remove mrg5R"></i>删除</a> </li>';
		            html+='';
		            html+='';
		            html+='';
		            html+='</ul>';
		            html+='</div>';
					return html;
				}},
			],
			"bServerSide": true,
			"sAjaxSource": "list/ajax",
			"fnServerData": retrieveData,
			"oLanguage":{
				"sInfoEmpty": "没有数据",
				"sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
				"sZeroRecords": "没有检索到数据",
				"oPaginate":{
					"sFirst": "首页",
					"sPrevious": "前页",
					"sNext": "后页",
					"sLast": "尾页"
				}
			},
			"fnDrawCallback":function(){
				$(".del").click(function(a,b,c) {
					$.messager.confirm("", "删除!", function() { 
				        location.href="/page/delete/"+a.delegateTarget.id.substring(4);
				    });
				})
			},
			"bRetrieve":true,
			"aoColumnDefs": [{
				sDefaultContent: '',
				aTargets: [ '_all' ]
			}]
			
		})
	})
	$(document).on("scroll",".dataTables_scrollBody",function(){$(".dataTables_scrollBody").css({"overflow":"visible","height":"100%"})})
});
</script>




